import sys

sys.path.append('../')

from config import *


@app.route('/login.do', methods = ['GET'])
def login_do():
    username = request.args.get('username', '').strip()
    password = request.args.get('password', '').strip()

    user = qushu_cv_match_user_coll.find_one({'username': username, 'password': password})

    if user:
        session['username'] = username
        session['role'] = user['role']
        session['uid'] = user['uid']

        return redirect(url_for('app22'))

    return render_template('login.html', errinfo = '用户名或者密码有误，请核实~')
